package ros_bag

import (
	"github.com/lherman-cs/go-rosbag"
	"iron_man_comm/src/ros_bag/msg"
)

func (r *RosBagParser) parserMsgByTopic(record *rosbag.RecordMessageData, topic string) {
	callback, ok := msg.G_map_serialize[topic]
	if ok {
		callback(&msg.FucData{
			Topic:         topic,
			Record:        record,
			Callback:      r.dataCallback,
			ErrorCallback: r.errorCallback,
		})
	}
}

func (r *RosBagParser) dataCallback(data msg.TopicData) {
	r.msgCallback(data)
}

func (r *RosBagParser) errorCallback(topic string, err error) {
	r.errCallback(topic, err)
}
